from typing import Optional

from langchain_core.output_parsers import SimpleJsonOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_openai import ChatOpenAI
from pydantic import BaseModel, Field

from env_utils import LOCAL_API_KEY, LOCAL_BASE_URL, DEEPSEEK_API_KEY, DEEPSEEK_BASE_URL


class OutDemo(BaseModel):
    answer: str = Field(description="回答的内容")
    other_question: str = Field(description="提示用户的下一个问题")

llm = ChatOpenAI(
    model="qwen3-8b",
    temperature=0.8,
    api_key=LOCAL_API_KEY,
    base_url=LOCAL_BASE_URL,
    extra_body={'chat_template_kwargs': {'enable_thinking': False}},
)

# llm = ChatOpenAI(
#     model="deepseek-chat",
#     temperature=0.8,
#     api_key=DEEPSEEK_API_KEY,
#     base_url=DEEPSEEK_BASE_URL
# )

runnable = llm.bind_tools([OutDemo])
resp = runnable.invoke("你知道高达seed吗")
print(resp)
